export default {
    data() {
        return {
            opinion: "",
            name: "",
            tel: "",
            openid: "",
        }
    },
    components: {
    },
    methods: {
        submit() {
            if (this.opinion.length < 1) {
                alert('请将信息填写完整')
                return
            }
            this.axios.post('/member/feedback', {
                openid: this.openid,
                description: this.opinion,
                nick: this.name,
                mobile: this.tel
            }).then(res => {
                if (res.data.result) {
                    console.log(res)
                    alert('谢谢您的反馈')
                }
            }, err => {

            })
        },
        getUser() {
            this.axios.get('/member/info', {
                params: {
                    openid: this.openid
                }
            }).then(res => {

                this.name = res.data.datas.nick;
                this.tel = res.data.datas.mobile ? res.data.datas.mobile : "12345678910"
            }, err => {

            })
        }
    },
    mounted() {
    },
    created() {
        this.openid = sessionStorage.getItem("openId")
        this.getUser();
    },
    computed: {
        leftNumber: function () {
            return 200 - this.opinion.length
        }
    }
}